package com.baobao_jk.tutorialmod.init;

import com.baobao_jk.tutorialmod.Main;
import com.baobao_jk.tutorialmod.throwable.entity.EntityIcebullet;
import com.baobao_jk.tutorialmod.throwable.render.RenderIcebullet;
import com.baobao_jk.tutorialmod.util.Reference;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.registry.EntityEntry;
import net.minecraftforge.fml.common.registry.EntityRegistry;

import java.util.ArrayList;
import java.util.List;

public class ModEntity {
    public static List<EntityEntry> ENTITYS = new ArrayList<>();

    public static void init(){
        initregister("icebullet", EntityIcebullet.class, 64, 10, true);
    }


    public static void register(){
        RenderingRegistry.registerEntityRenderingHandler(EntityIcebullet.class, renderManager -> new RenderIcebullet(renderManager));
    }

    private static int entityID = 0;

    public static void initregister(String name, Class<? extends Entity> entityClass , int r, int tick , boolean sendupdata){

        final ResourceLocation registryName = new ResourceLocation(Reference.MOD_ID, name);
        EntityRegistry.registerModEntity(registryName, entityClass, registryName.toString(), entityID++, Main.instance, r, tick, sendupdata);
    }
}
